/**
 * Created by MMangoo on 2018/9/24.
 */
window.onload=function () {
    var qrZhu = document.getElementById("qr-zhu");
    var qrWe = document.getElementById("qr-wechat");
    var zhuShou = document.querySelector(".zhushou");
    var weChat = document.querySelector(".wechat");
    qrZhu.onclick = function () {
        qrZhu.classList.add("lighting");
        zhuShou.style.zIndex = "1";
        weChat.style.zIndex = "-1";
        qrWe.classList.remove("lighting");
        console.log("12221");
    };
    qrWe.onclick = function () {
        qrWe.classList.add("lighting");
        zhuShou.style.zIndex = "-1";
        weChat.style.zIndex = "1";
        qrZhu.classList.remove("lighting");
        console.log("12221");

    };

    var photoTitle = document.querySelector("#main-content .photo-carousel");
    var bannerList = document.querySelector("#main-content ul");
    var bannerArr = document.querySelectorAll("#wrap .banner");
    var titleArr = document.querySelectorAll("#main-content .title");
    var index = 0;
    var oneInterval=setInterval(change,1000);

    photoTitle.onmouseover=function(){
        clearInterval(oneInterval);

        /* 给小点设置点击事件 */
        for(var i=0;i<titleArr.length;i++){
            function setClick(x){
                titleArr[x].onmouseover=function(){
                    roll(x);
                }
            }
            setClick(i);
        }
        function roll(argm){
                index=argm;
            for(var i=0;i<titleArr.length;i++){
                titleArr[i].classList.remove("actively");
            }
            bannerList.style.transform = "translateX("+(-index*799)+"px)";
            titleArr[index].classList.add("actively");
        }



    };
    photoTitle.onmouseleave=function(){
        oneInterval=setInterval(change,1000);
    };

   function change() {
       if(index<titleArr.length){
           for(var i=0;i<titleArr.length;i++){
               titleArr[i].classList.remove("actively");
           }
           bannerList.style.transform = "translateX("+(-index*799)+"px)";
           titleArr[index].classList.add("actively");
           index++;

       }else {
           index=0;
           for(var i=0;i<titleArr.length;i++){
               titleArr[i].classList.remove("actively");
           }
           titleArr[index].classList.add("actively");
           bannerList.style.transform = "translateX("+(-index*799)+"px)";

       }
    }
    change();
    var leiBieArr= document.querySelectorAll("#main-content .media-exp>.media>ul>li>a");
    var neiRong=document.querySelector(".message ul");

    for(var i=1;i<leiBieArr.length;i++){
        function setClick(x){
            leiBieArr[x].onclick=function(){
                rollTwo(x);
            }
        }
        setClick(i);
    }
    function rollTwo(argm){
        index=argm;
        for(var i=0;i<leiBieArr.length;i++){
            leiBieArr[i].style.borderBottom="0"
        }
        neiRong.style.transform = "translateX("+(-index*372)+"px)";
        leiBieArr[index].style.borderBottom="2px solid #ff8f17"
    }

    var leiBiEArr= document.querySelectorAll("#main-content .media-exp>.way>ul>li>a");
    var neiRonG=document.querySelector(".messages ul");

    for(var i=1;i<leiBiEArr.length;i++){
        function setClicK(x){
            leiBiEArr[x].onclick=function(){
                rollThree(x);
            }
        }
        setClicK(i);
    }
    function rollThree(argm){
        index=argm;
        for(var i=0;i<leiBiEArr.length;i++){
            leiBiEArr[i].style.borderBottom="0"
        }
        neiRonG.style.transform = "translateX("+(-index*372)+"px)";
        leiBiEArr[index].style.borderBottom="2px solid #ff8f17"
    }


    var leiBiEArR= document.querySelectorAll("#main-content .active-html>.media>ul>li>a");
    var neiRoNG=document.querySelector(".messagess ul");

    for(var i=0;i<leiBiEArR.length;i++){
        function setCliCK(x){
            leiBiEArR[x].onclick=function(){
                rollFour(x);
            }
        }
        setCliCK(i);
    }
    function rollFour(argm){
        index=argm;
        for(var i=0;i<leiBiEArR.length;i++){
            leiBiEArR[i].style.borderBottom="0"
        }
        neiRoNG.style.transform = "translateX("+(-index*372)+"px)";
        leiBiEArR[index].style.borderBottom="2px solid #2fc3a3"
    }

    let menIconArr=document.querySelectorAll("#right .iconR>i");
    let menWordArr=document.querySelectorAll("#right .menpai-int .menpai-word");
    let menImgArr=document.querySelectorAll("#right .menpai-int img");
    menIconArr[0].style.color="#2fc3a2";
    menWordArr[0].style.left="0%";
    menWordArr[0].style.top="20px";
    menImgArr[0].style.left="38%";
    for(let i=0;i<menIconArr.length;i++){
        menIconArr[i].onclick=function () {
            for(let j=0;j<menIconArr.length;j++){
                menImgArr[j].style.left="380%";
                menWordArr[j].style.left="-380%";
                menIconArr[j].style.color="#B9C1C1"
            }
            menMove(i);
        }
    }
    function menMove(i) {
        menIconArr[i].style.color="#2fc3a2";
        menWordArr[i].style.left="0%";
        menWordArr[i].style.top="20px";
        menImgArr[i].style.left="38%";
        menWordArr[i].style.transitionDuration="400ms";
        menImgArr[i].style.transitionDuration="400ms"
    }



    let dtT=document.querySelector(".qz-video>dt");
    let ddT=document.querySelector(".qz-video");
    dtT.onclick=function () {
        ddT.style.left="-392px"
    };
    let dto=document.querySelector(".qz-other>dt");
    let ddo=document.querySelector(".qz-other");
    dto.onclick=function () {
        ddo.style.left="-324px"
    };
    let dtp=document.querySelector(".qz-piant>dt");
    let ddp=document.querySelector(".qz-piant");
    dtp.onclick=function () {
        ddp.style.left="-256px"
    };
    let dtn=document.querySelector(".qz-novel>dt");
    let ddn=document.querySelector(".qz-novel");
    dtn.onclick=function () {
        ddn.style.left="-188px"
    };
    let dtm=document.querySelector(".qz-music>dt");
    let ddm=document.querySelector(".qz-music");
    dtm.onclick=function () {
        ddm.style.left="-120px"
    };
    let dtg=document.querySelector(".qz-gift>dt");
    let ddg=document.querySelector(".qz-gift");
    dtg.onclick=function () {
        ddg.style.left="-52px"
    };


};



